<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="com.shsh.safemanage.model.JobPost"%>
<%@page import="com.shsh.safemanage.dao.TitlePostManageGroupDao"%>
<%@page import="java.util.Calendar"%>
<%@page import="com.shsh.safemanage.dao.DepartmentDao"%>
<%@page import="com.shsh.safemanage.dao.PostCheckDao"%>
<%@page import="com.shsh.safemanage.model.Department1"%>
<%@page import="com.shsh.safemanage.model.ProblemTransfer"%>
<%@page import="com.shsh.safemanage.model.ProblemTransferFeedback"%>
<%@page import="com.shsh.safemanage.model.Problem"%>
<%@page import="com.shsh.safemanage.model.Shutdown"%>
<%@page import="com.shsh.safemanage.model.ShutdownType"%>
<%@page import="java.util.List"%>
<%@page import="com.shsh.safemanage.util.Util"%>
<%@page import="com.shsh.safemanage.dao.DaoCreator"%>
<%@page import="com.shsh.safemanage.dao.ProblemDao"%>
<%@page import="com.shsh.safemanage.util.Constants"%>
<%@page import="com.shsh.safemanage.util.Util"%>

<%
	session.removeAttribute(Constants.SESSION_ESCALATE_USER);
	session.removeAttribute(Constants.SESSION_MANAGE_GROUP_USER);
	session.removeAttribute(Constants.SESSION_PROBLEM_DEPARTMENT1);

String problemIDStr = request.getParameter(Constants.REQUEST_PARAMETER_ID);
Long problemID = 0L;
try {
	problemID = new Long(problemIDStr);
} catch (Exception e) {
}

String transferIDStr = request.getParameter(Constants.REQUEST_PARAMETER_TRANSFER_ID);
Long transferID = null;
try {
	transferID = new Long(transferIDStr);
} catch (Exception e) {
}

String fromPage = request.getParameter(Constants.REQUEST_PARAMETER_FROM_PAGE);
String backPage = request.getContextPath()+"/shutdown/shutdown_browse.jsp";
if(Constants.FROM_PAGE_PROBLEMS_TOBE_PROCESSED.equals(fromPage)){
	backPage = request.getContextPath()+"/problems_tobe_processed.jsp";
} else if (Constants.FROM_PAGE_SUPERVISE_PAGE.equals(fromPage)) {
	backPage = request.getContextPath() + "/problems_tobe_processed_supervise.jsp";
} else if (Constants.FROM_PAGE_YIBAN_PAGE.equals(fromPage)){
	backPage = request.getContextPath()+"/problem_browse.jsp";
}

DepartmentDao departmentDao = DaoCreator.createDepartmentDao();
ProblemDao problemDao = DaoCreator.createProblemDao();
UserDao userDao = DaoCreator.createUserDao();

TitlePostManageGroupDao titlePostManageGroupDao = DaoCreator.createTitlePostManageGroupDao();
WriteProblemAction writeProblemAction = ActionCreator.createWriteProblemAction();
UserAction userAction = ActionCreator.createUserAction();

Shutdown problem = problemDao.getShutdownByID(problemID);
String problemName = Shutdown.getProblemName(problem.getProblemType());

int[] periodStart = Util.getDate(problem.getPeriodStart());
int periodStartMonthEnd = Util.getMonthEnd(periodStart[0], periodStart[1]);
int[] periodEnd = Util.getDate(problem.getPeriodEnd());
int periodEndMonthEnd = Util.getMonthEnd(periodEnd[0], periodEnd[1]);

List<ProblemTransferFeedback> feedbackList = problemDao.getProblemTransferFeedbackByProblemID(problemID);

User user = (User) session.getAttribute(Constants.SESSION_USER);
User shutdownWriteUser = userDao.getUserByID(problem.getShutdownWriteUserID());
JobPost post1 = titlePostManageGroupDao.getJobPostByID(user.getJobPost1ID());
JobPost post2 = titlePostManageGroupDao.getJobPostByID(user.getJobPost2ID());
JobPost post3 = titlePostManageGroupDao.getJobPostByID(user.getJobPost3ID());
Role theRole = userAction.getUserRole(request);

int role = writeProblemAction.calRole(post1, post2, post3, theRole);

List<ShutdownType> shutdownTypeList = problemDao.getShutdownTypeList();
ProblemTransfer currentTransfer = problemDao.getProblemTransfer(problem.getWriteUserID(), problemID, user.getId());
if(currentTransfer != null){
	transferID = currentTransfer.getId();
}
%>
<div class="hider" id="hider">
	<span>&nbsp;</span>
</div>
<div class="position">
	<img src="images/position2.jpg" style="padding: 7px 9px; float: left;" />当前位置：上海高桥分公司问题管理平台 &gt;&gt; <%=problemName %>浏览 
</div>

<div class="tt">《高桥石化公司<%=problemName %>报告》</div>
<div class="content">
	<table align="center" border="1" width="99%" cellpadding="0"
		cellspacing="0">
	<tr>
		<td class="td1" colspan="2">
			<span style="margin-left: 30px; font-weight: bold">流程跟踪：</span>
			<!-- 
			<br />
			<span style="margin-left: 50px; color: red">
			<%=Util.formatDateTime(problem.getWriteTime())%> <%=problem.getWriteUserName()%> 填报问题
			</span>
			 -->
			<%
			for (ProblemTransferFeedback feedback : feedbackList) {
			%>
			<br />
			<span style="margin-left: 50px; color: red">
			<%=Util.formatDateTime(feedback.getFeedbackTime())%>
			<%
			User theFeedbackUser = userDao.getUserByID(feedback.getUserID());
			%>
			<%=theFeedbackUser.getName()%>
			<%=feedback.getProcessMethod() == Constants.PROCESS_METHOD_CLOSE? "确认同意":feedback.getProcessMethodStr()%>
			</span>
			<%
			}
			%>
		</td>
	</tr>
	<tr>
		<td class="td1" colspan="2"><span style="margin-left: 30px; font-weight: bold">作业部（业务中心）：</span> <span><%=problem.getDepartment1Name()%></span>
			<span style="margin-left: 30px; font-weight: bold">装置：</span> <span><%=problem.getEquipmentName()%></span>
			<span style="margin-left: 30px; font-weight: bold"><%=problemName %>性质：</span> <span><%=problem.getShutdownType()%></span>
<%
if(problem.getProblemType() == Constants.PROBLEM_TYPE_NOTPLANED_SHUTDOWN) {
%>
				<span style="margin-left: 30px; font-weight: bold">
					<input disabled="disabled" type="checkbox" id="escalateZongbu" name="escalateZongbu" value="true" <%=problem.getEscalateZongbu()!=null&&problem.getEscalateZongbu()?"checked=\"checked\"":"" %>/>
					<label for="escalateZongbu">上报总部</label>
				</span>
<%
}
%> 
		</td>
	</tr>
	<tr>
			<td class="td1" width="60%">	
			<table width="100%">
			<tr>
				<td rowspan="2">
				<span style="margin-left: 30px; font-weight: bold"><%=problemName %>时间段：</span> 
				</td>
				<td>		
				<span style="margin-left: 10px; ">						
						<select id="startYear" onchange="refreshPeriodStart(true)">
							<%
							for(int i=2001;i<=2050;i++){
							%>
							<option value="<%=i %>" 
								<%
								if(i==periodStart[0]){
								%>
								selected="selected"
								<% 
								}
								%>								
								><%=i %></option>
							<%
							}
							%>
						</select>
						年						
						<select id="startMonth" onchange="refreshPeriodStart(true)">
							<%
							for(int i=1;i<=12;i++){
							%>
							<option value="<%=i %>" 
								<%
								if(i==periodStart[1]){
								%>
								selected="selected"
								<% 
								}
								%>								
								><%=i %></option>
							<%
							}
							%>
						</select>
						月				
						<select id="startDay" onchange="refreshPeriodStart(false)">
							<%
							for(int i=1;i<=periodStartMonthEnd;i++){
							%>
							<option value="<%=i %>" 
								<%
								if(i==periodStart[2]){
								%>
								selected="selected"
								<% 
								}
								%>								
								><%=i %></option>
							<%
							}
							%>
						</select>
						日		
						<select id="startHour" onchange="refreshPeriodStart(false)">
							<%
							for(int i=0;i<=23;i++){
							%>
							<option value="<%=i %>" 
								<%
								if(i==periodStart[3]){
								%>
								selected="selected"
								<% 
								}
								%>								
								><%=i %></option>
							<%
							}
							%>
						</select>
						时
						<select id="startMinute" onchange="refreshPeriodStart(false)">
							<%
							for(int i=0;i<=59;i++){
							%>
							<option value="<%=i %>" 
								<%
								if(i==periodStart[4]){
								%>
								selected="selected"
								<% 
								}
								%>								
								><%=i %></option>
							<%
							}
							%>
						</select>
						分
				</span>	
				</td>
			</tr>
			<tr>
			<td>
				<span style="margin-left: 10px; ">						
						<select id="endYear" onchange="refreshPeriodEnd(true)">
							<%
							for(int i=2001;i<=2050;i++){
							%>
							<option value="<%=i %>" 
								<%
								if(i==periodEnd[0]){
								%>
								selected="selected"
								<% 
								}
								%>								
								><%=i %></option>
							<%
							}
							%>
						</select>
						年						
						<select id="endMonth" onchange="refreshPeriodEnd(true)">
							<%
							for(int i=1;i<=12;i++){
							%>
							<option value="<%=i %>" 
								<%
								if(i==periodEnd[1]){
								%>
								selected="selected"
								<% 
								}
								%>								
								><%=i %></option>
							<%
							}
							%>
						</select>
						月				
						<select id="endDay" onchange="refreshPeriodEnd(false)">
							<%
							for(int i=1;i<=periodEndMonthEnd;i++){
							%>
							<option value="<%=i %>" 
								<%
								if(i==periodEnd[2]){
								%>
								selected="selected"
								<% 
								}
								%>								
								><%=i %></option>
							<%
							}
							%>
						</select>
						日		
						<select id="endHour" onchange="refreshPeriodEnd(false)">
							<%
							for(int i=0;i<=23;i++){
							%>
							<option value="<%=i %>" 
								<%
								if(i==periodEnd[3]){
								%>
								selected="selected"
								<% 
								}
								%>								
								><%=i %></option>
							<%
							}
							%>
						</select>
						时
						<select id="endMinute" onchange="refreshPeriodEnd(false)">
							<%
							for(int i=0;i<=59;i++){
							%>
							<option value="<%=i %>" 
								<%
								if(i==periodEnd[4]){
								%>
								selected="selected"
								<% 
								}
								%>								
								><%=i %></option>
							<%
							}
							%>
						</select>
						分
				</span>	
			</td>
			</tr>
			</table>
			</td>
			<td  class="td1" width="40%">
				<span style="margin-left: 30px; font-weight: bold"><%=problemName %>时间：</span> 
				共<input  style="margin-left: 0px; width:50px;" readonly="readonly" type="text" id="periodMinutes" value="0"/>分钟
				<br/>
				<input  style="margin-left: 30px; width:35px;" readonly="readonly" type="text" id="periodDay"value="0"/>天
				<input  style="margin-left: 5px; width:25px;" readonly="readonly" type="text" id="periodHour" value="0"/>小时
				<input  style="margin-left: 5px; width:25px;" readonly="readonly" type="text" id="periodMinute" value="0"/>分钟
			</td>
	</tr>
	<tr>
			<td class="td1" colspan="2">			
				<span style="margin-left: 30px; font-weight: bold"><%=problemName %>名称：</span>  <br/>
				<span style="margin-left: 30px; ">
						<textarea rows="3" style="width:90%;" id="problemTitle"><%=problem.getProblemTitle()%></textarea>	
				</span>	
			</td>
	</tr>
	<tr>
		<td class="td1" colspan="2"><span
			style="margin-left: 30px; font-weight: bold"><%=problemName %>经过：</span> <br/>
			<span style="margin-left: 30px; ">
			<textarea rows="5" style="width:90%;" id="problemContent"><%=problem.getProblemContent()%></textarea>	
			</span>
		</td>
	</tr>
	<tr>
		<td class="td1" colspan="2"><span
			style="margin-left: 30px; font-weight: bold">直接经济损失与间接经济损失：
			</span> 
			<br/>
			<span style="margin-left: 30px; ">
			<textarea rows="5" style="width:90%;" id="loss"><%=problem.getLoss()%></textarea>	
			</span>
		</td>
	</tr>
	<tr>
		<td class="td1" colspan="2"><span
			style="margin-left: 30px; font-weight: bold"><%=problemName %>原因：
			</span> 
			<br/>
			<span style="margin-left: 30px; ">
			<textarea rows="10" style="width:90%;" id="reason"><%=problem.getReason()%></textarea>	
			</span>
		</td>
	</tr>
	<tr>
		<td class="td1" colspan="2"><span
			style="margin-left: 30px; font-weight: bold"><%=problemName %>教训及防范措施：
			</span> 
			<br/>
			<span style="margin-left: 30px; ">
			<textarea rows="10" style="width:90%;" id="zhenggai_cuoshi"><%=problem.getProblemZhenggai()%></textarea>	
			</span>
		</td>
	</tr>
	<tr>
		<td class="td1" colspan="2"><span
			style="margin-left: 30px; font-weight: bold"><%=problemName %>责任分析及处理情况：
			</span> 
			<br/>
			<span style="margin-left: 30px; ">
			<textarea rows="10" style="width:90%;" id="duty"><%=Util.isNullOrEmpty(problem.getDuty())?"":problem.getDuty()%></textarea>	
			</span>
		</td>
	</tr>
	<tr>
		<td class="td1" colspan="2"><span
			style="margin-left: 30px; font-weight: bold"><%=problemName %>调查小组人员名单：
			</span> 
			<br/>
			<span style="margin-left: 30px; ">
			<textarea rows="5" style="width:90%;" id="team"><%=Util.isNullOrEmpty(problem.getTeam())?"":problem.getTeam()%></textarea>	
			</span>
		</td>
	</tr>
		<tr>
			<td class="td1" colspan="2">
				<span style="margin-left: 30px" class="span1">停工报告填报人及时间：</span>
				<span><%=shutdownWriteUser.getDepartment1Name()%>-<%=shutdownWriteUser.getDepartment2Name()%>-<%=shutdownWriteUser.getDepartment3Name()%></span>
				<span><%=shutdownWriteUser.getName()%></span>
				<span><%=Util.formatDateTime(problem.getShutdownWriteTime())%></span>
			</td>
		</tr>
		<tr>
			<td class="td1" colspan="2">
				<span style="margin-left: 30px; font-weight: bold">反馈信息：</span>
				<br />
				<div id="feedbackProcessMethodDiv">
				<%@include file="/shutdown/shutdown_feedback_process_method.jsp" %>
				</div>				
			</td>
		</tr>	
		<tr id="informedPersonsTR">
			<td class="td1" colspan="2">
				<%
				if ((role & Constants.ROLE_TYPE_ZUZHANG) > 0) {
				%>
				<div id="informPersonDiv">
				<%@include file="/problem_feedback_informed_person.jsp" %>
				</div>
				<%
				}
				%>
				<%
				if ((role & (Constants.ROLE_TYPE_ZHUANGZHIZHANG | Constants.ROLE_TYPE_ZUZHANG | Constants.ROLE_TYPE_SHENGCHANFUBUZHANG
						 | Constants.ROLE_TYPE_ANQUANZONGJIAN | Constants.ROLE_TYPE_SHEBEIFUBUZHANG | Constants.ROLE_TYPE_BUZHANG)) > 0) {
				%>
				<div id="chooseManageGroupUserDiv">
				<%@include file="/managegroup_select/manage_check_samepage_section.jsp"%>
				</div>
				<%
				}
				%>
				<%
				if ((role & (Constants.ROLE_TYPE_KEYUAN | Constants.ROLE_TYPE_KEZHANG | Constants.ROLE_TYPE_FUKEZHANG 
						| Constants.ROLE_TYPE_FUCHUZHANG | Constants.ROLE_TYPE_CHUZHANG)) > 0) {
				%>
				<div id="chooseChushiTransferDiv">
				<%@include file="/chushi_informed_person.jsp"%>
				</div>
				<%
				}
				%>
			</td>
		</tr>
		<tr>
			<td class="td1" colspan="2">
				<span style="margin-left: 30px" class="span1">填报人及时间：</span>
				<span><%=user.getDepartment1Name()%>-<%=user.getDepartment2Name()%>-<%=user.getDepartment3Name()%></span>
				<span><%=user.getName()%></span>
				<span><%=Util.formatDateTime(Calendar.getInstance())%></span>
			</td>
		</tr>
		<tr>
			<td class="td1" align="center" colspan="2">
				<% if(!"postcheckReport".equals(fromPage) && theRole.getRoleLevel() >= Constants.ROLE_LEVEL_KEJI) {%>
				<input type="button" value="提 交" onclick="feedback()" />
				<%} %>
				<input type="button" value="取 消" style="margin-left: 20px" onclick="cancelFeedback()" />
			</td>
		</tr>
	</table>
</div>
<div id="selectDepart1Div" style="display: block;">
<%@include file="/shutdown/select_depart1ID_section.jsp" %>
</div>
<script type="text/javascript">
var shutdownTypes = new Array();
<%
for (ShutdownType type : shutdownTypeList) {
%>
shutdownTypes.push("<%=type.getId()%>_<%=type.getDepartment1ID()%>");
<%
}
%>

function feedback() {
	var feedback = '';
	
	var startYear = $("#startYear").val();
	var startMonth = $("#startMonth").val();
	var startDay = $("#startDay").val();
	var startHour = $("#startHour").val();
	var startMinute = $("#startMinute").val();
	
	var endYear = $("#endYear").val();
	var endMonth = $("#endMonth").val();
	var endDay = $("#endDay").val();
	var endHour = $("#endHour").val();
	var endMinute = $("#endMinute").val();
	
	var processMethod = 0;
	var processRadio0 = document.getElementById('processRadio0');
	var processRadio1 = document.getElementById('processRadio1');
	var processRadio2 = document.getElementById('processRadio2');
	var processRadio3 = document.getElementById('processRadio3');
	var processRadio4 = document.getElementById('processRadio4');
	var processRadio5 = document.getElementById('processRadio5');
	var processRadio6 = document.getElementById('processRadio6');
	if (processRadio1 != null && processRadio1.checked) {
		processMethod = 1;
	} else if (processRadio2 != null && processRadio2.checked) {
		processMethod = 2;
	} else if (processRadio3 != null && processRadio3.checked) {
		processMethod = 3;
	} else if (processRadio4 != null && processRadio4.checked) {
		processMethod = 4;
	} else if (processRadio5 != null && processRadio5.checked) {
		processMethod = 5;
	} else if (processRadio6 != null && processRadio6.checked) {
		processMethod = 6;
	} else if (processRadio0 != null && processRadio0.checked) {
		processMethod = 0;
	}
	
	var userIDs = '';
	var userIDElements = document.getElementsByName('informedUserID');
	for (var i = 0; i != userIDElements.length; i++) {
		var userIDEle = userIDElements[i];
		if (userIDEle.checked) {
			if (userIDs == '') {
				userIDs = userIDs + userIDEle.value;
			} else {
				userIDs = userIDs + ',' + userIDEle.value;
			}
		}
	}
	
	var manageGroupUserCheckEles = document.getElementsByName('manageGroupUserCheck');
	for (var i = 0; i != manageGroupUserCheckEles.length; i++) {
		if (manageGroupUserCheckEles[i].checked) {
			if (userIDs == '') {
				userIDs = userIDs + manageGroupUserCheckEles[i].value;
			} else {
				userIDs = userIDs + ',' + manageGroupUserCheckEles[i].value;
			}
		}
	}
	var problemTitle = getElementValueByID("problemTitle");
	var problemContent = getElementValueByID("problemContent");
	var loss = getElementValueByID("loss");
	var reason = getElementValueByID("reason");
	var zhenggai_cuoshi = getElementValueByID("zhenggai_cuoshi");
	var duty = getElementValueByID("duty");
	var team = getElementValueByID("team");
	
	if(problemTitle == null || problemTitle == '' || problemTitle == 'undefined') {
		$.dialog.alert('请填写<%=problemName %>名称');
		return;
	}
	
	if(reason == null || reason == '' || reason == 'undefined') {
		$.dialog.alert('请填写<%=problemName %>原因');
		return;
	}	
	
	
	if(zhenggai_cuoshi == null || zhenggai_cuoshi == '' || zhenggai_cuoshi == 'undefined') {
		$.dialog.alert('请填写教训及防范措施');
		return;
	}		
	if(duty == null || duty == '' || duty == 'undefined') {
		$.dialog.alert('请填写责任分析及处理情况');
		return;
	}
	
	if(team == null || team == '' || team == 'undefined') {
		$.dialog.alert('请填写调查小组人员名单');
		return;
	}	
	
	var msg = "您确定反馈此报告？";
	if(processMethod == 2){
		msg = "您确定反馈此报告？<br/>注：该系统不支持组员（科员）对该报告进行操作";
	}
	

				
				$.dialog.confirm(msg, function() {
					openWaitingDialog('waitingDialog');
					$.ajax({
						type:'post',
						url:'<%=request.getContextPath()%>/shutdown/feedback_shutdown_process.jsp',
						data:{
							processMethod: processMethod,
							id: <%=problemID%>,
							feedback: feedback,
							transferID: <%=transferID%>,
							problemTitle: problemTitle,
							problemContent: problemContent,
							loss: loss,
							reason: reason,
							zhenggai_cuoshi: zhenggai_cuoshi,
							duty: duty,
							team: team,
							startYear: startYear,
							startMonth: startMonth,
							startDay: startDay,
							startHour: startHour,
							startMinute: startMinute,
							endYear: endYear,
							endMonth: endMonth,
							endDay: endDay,
							endHour: endHour,
							endMinute: endMinute,
							userID: userIDs
						},
						success:function(data,state,xmlhttp){
							var obj = null;
							try {
								obj = eval('(' + data + ')');
							} catch (e) {
							}
							if (typeof(obj.isSuccess) != 'undefined') {
								closeWaitingDialog('waitingDialog');
								if (obj.isSuccess == 'true') {
									$.dialog('报告反馈成功！', function() {
										loadPageSection('<%=backPage%>', 'mainContentDiv', {fromPage: 'feedback', problemType: <%=problem.getProblemType()%>}, true);
									});
								} else {
									$.dialog.alert(obj.error);
								}
							}
						}
					});
				});
}

function refreshMonthEnd(year, month, dayEle){
	var day = $(dayEle).val();
	
	$(dayEle).empty();
	for (var i = 1;i<=28;i++){
		 $(dayEle).append("<option value='"+i+"'>"+i+"</option>"); 
	}
	if(month == 2){
		var maxDay = 28;
		if(isLeap(year)){
			//闰年
			 $(dayEle).append("<option value='"+29+"'>"+29+"</option>"); 
			maxDay = 29;
		}
		if(day>maxDay){
			day = maxDay;
		}

		 $(dayEle).val(day);
	} else if(month == 4 || month == 6 || month == 9 || month == 11){
		//30天
		 $(dayEle).append("<option value='"+29+"'>"+29+"</option>"); 
		 $(dayEle).append("<option value='"+30+"'>"+30+"</option>");
		 
		 if(day == 31 ){
			 day = 30;
		 }
		 $(dayEle).val(day);
	} else {
		//31天
		 $(dayEle).append("<option value='"+29+"'>"+29+"</option>"); 
		 $(dayEle).append("<option value='"+30+"'>"+30+"</option>"); 
		 $(dayEle).append("<option value='"+31+"'>"+31+"</option>"); 
		 $(dayEle).val(day);
	}
}

function refreshPeriodStart(updateMonthEnd){
	var startYear = $("#startYear").val();
	var startMonth = $("#startMonth").val();
	
	if(updateMonthEnd){
		refreshMonthEnd(startYear, startMonth, $("#startDay"));
	}
	
	var startDay = $("#startDay").val();
	var startHour = $("#startHour").val();
	var startMinute = $("#startMinute").val();
	
	var endYear = $("#endYear").val();
	var endMonth = $("#endMonth").val();
	var endDay = $("#endDay").val();
	var endHour = $("#endHour").val();
	var endMinute = $("#endMinute").val();
	
	var minutes = getMinutes(endYear, endMonth, endDay, endHour, endMinute, startYear, startMonth, startDay, startHour, startMinute);

	if(minutes < 0){
		$.dialog.alert("请确保停工结束时间晚于停工开始时间");
		return;
	}
	$("#periodMinutes").val(minutes);
	var period = getPeriod(minutes);

	$("#periodDay").val(period[0]);
	$("#periodHour").val(period[1]);
	$("#periodMinute").val(period[2]);
}

function refreshPeriodEnd(updateMonthEnd){
	var startYear = $("#startYear").val();
	var startMonth = $("#startMonth").val();
	var startDay = $("#startDay").val();
	var startHour = $("#startHour").val();
	var startMinute = $("#startMinute").val();
	
	var endYear = $("#endYear").val();
	var endMonth = $("#endMonth").val();

	if(updateMonthEnd){
		refreshMonthEnd(startYear, startMonth, $("#endDay"));
	}
	
	var endDay = $("#endDay").val();
	var endHour = $("#endHour").val();
	var endMinute = $("#endMinute").val();
	
	var minutes = getMinutes(endYear, endMonth, endDay, endHour, endMinute, startYear, startMonth, startDay, startHour, startMinute);

	$("#periodMinutes").val(minutes);
	var period = getPeriod(minutes);

	$("#periodDay").val(period[0]);
	$("#periodHour").val(period[1]);
	$("#periodMinute").val(period[2]);
}

function cancelFeedback() {
	$.dialog.confirm('您确定取消此次反馈吗？', function() {
		loadPageSection('<%=backPage%>', 'mainContentDiv', {fromPage: 'feedback', problemType: <%=problem.getProblemType()%>}, true);
	}, function(){});
}

function chooseProcessMethod(method) {
	if (method == 1) {
		document.getElementById('informedPersonsTR').style.display = 'none';
		//document.getElementById('feedback').readonly = true;
		var zhenggaiCuoshi = getElementValueByID('zhenggai_cuoshi');
		//setElementValueByID('zhenggai_cuoshi', zhenggaiCuoshi + '\r\n' +'<%=user.getDepartment1Name()%>，<%=user.getJobPost1Name()%><%=user.getName()%>同意');
	} else if (method == 2) {
		document.getElementById('informedPersonsTR').style.display = '';
		//document.getElementById('feedback').readonly = false;
		//setElementValueByID('feedback', '');
	} else if (method == 4 || method == 3 || method == 5 || method == 6 || method == 0) {
		document.getElementById('informedPersonsTR').style.display = 'none';
		//setElementValueByID('feedback', '');
	}
}

refreshPeriodStart(false);
refreshPeriodEnd(false);
</script>
